<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <!-- js里面的第一个定时器里面的方法都执行完以后，才会执行下面的定时器 -->
        <!-- 无论是then还是catch,只要throw抛出了错误，就会被catch捕获，如果没有throw出错误，就会继续执行后面的then -->
        <script>
            setTimeout(() => {
                console.log('111');
                new Promise((resolve) => {
                    console.log('222');
                    resolve('111');
                }).then((res) => {
                    console.log(res);
                });
            });
            setTimeout(() => {
                console.log('333');
                new Promise((resolve) => {
                    console.log('222');
                    resolve('111');
                }).then((res) => {
                    console.log(res);
                });
            });
        </script>
    </body>
</html>
